package com.xca.znb.model.impl;

import android.content.Context;

import com.xca.znb.database.UserDAO;
import com.xca.znb.entity.Cart;
import com.xca.znb.entity.Goods;
import com.xca.znb.entity.User;
import com.xca.znb.model.imodel.ICartEndPay;

public class CartEndPayImpl implements ICartEndPay {
    private UserDAO userDAO ;
    public CartEndPayImpl(Context context){
        userDAO = new UserDAO(context);
    }
    @Override
    public boolean addOrder(int localId, int goodsId, int num, String remark, String buyer, String sales, String type, String time) {
        return userDAO.addOrder(localId, goodsId, num, remark, buyer, sales, type, time);
    }

    @Override
    public Goods getGoodsById(int id) {
        return userDAO.getGoodsById(id);
    }

    @Override
    public double getBalance(String phone) {
        return userDAO.getSum(phone);
    }

    @Override
    public void insertAccount(String phone, double num, String type, String time_day, String time_sec) {
        userDAO.insertAccount(phone, num, type, time_day, time_sec);
    }

    @Override
    public Cart getCartById(int id) {
        return userDAO.getCartById(id);
    }

    @Override
    public User getUserByPhone(String phone) {
        return userDAO.getUser(phone);
    }
}
